<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/css/style.css" />


<!--_footer 作为公共模版分离出去-->
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>static/layer/2.4/layer.js"></script>
<script type="text/javascript" src="<%=basePath%>static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<script type="text/javascript">

$(function(){
	/* 动态加载一二级菜单 */
	$.ajax({
          async: false,
          type: "GET",
          url: "<%=basePath%>jsp/menu/getParentMenu.action",
          dataType: "json",
         success: function (data) {
            for (var i = 0; i < data.length; i++) {
                 $("#parentid").append("<option value="+data[i].mid+">" + data[i].mname + "</option>");
             }
         }
     });
	
	
	
	$('#btn').click(function() {
		//表单目标
		console.log("-----")
		var url = "<%=basePath%>jsp/menu/valueUpdata.action";
		var data = $("#form-member-add").serialize(); //表单数据
		console.log( url+"?"+data)
		$.ajax({
            type:"POST",
            url:url,
            data:data,
            dataType:"text",
            success:function(result){
            	if (result == "success") {
					alert("修改成功")
					parent.window.location.reload();
			        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
			        parent.layer.close(index);
				}else {
					alert("修改失败")
				}
            },
            error:function(response){
            	console.table( response )
            }
        });
	});
});
</script>
</head>
<body>
<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-member-add">
		<input type=text name="mid" value="${m.mid}" style="visibility:hidden">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单名称</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" id="mname" name="mname"  value="${m.mname}">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" id="url" name="url" value="${m.url}">
			</div>
		</div>
		<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>是否展示：</label>
		<div class="formControls col-xs-8 col-sm-9 skin-minimal">
			<div class="radio-box">
				<c:if test="${m.isshow == 0}">
					<input name="isshow" type="radio" id="isshow" value="1">
				</c:if>
				<c:if test="${m.isshow == 1}">
					<input name="isshow" type="radio" id="isshow" value="1" checked>
				</c:if>
				<label for="sex-1">展示</label>
			</div>
			<div class="radio-box">
				<c:if test="${m.isshow == 1}">
					<input type="radio" id="isshow" name="isshow" value="0">
				</c:if>
				<c:if test="${m.isshow == 0}">
					<input name="isshow" type="radio" id="isshow" value="0" checked>
				</c:if>
				<label for="sex-2">隐藏</label>
			</div>
		</div>
	</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>父菜单：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select type="text" class="input-text" id="parentid" name="parentid">
					<option value="">${m.parentMenu}</option>
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单图标代码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" id="icon" class="input-text" name="icon" value="${m.icon}">
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<a style="display:inline-block" id="btn" class="btn btn-primary radius" >提交</a>
			</div>
		</div>
	</form>
</article>

<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>